g_return_if_fail (GDK_IS_SURFACE (surface));
- if (GDK_SURFACE_DESTROYED (surface) ||
- !surface->accept_focus)
+ if (GDK_SURFACE_DESTROYED (surface))
return;
impl = GDK_BROADWAY_SURFACE (surface);
case LAST_PROP + GDK_TOPLEVEL_PROP_ICON_LIST:
break;
- case LAST_PROP + GDK_TOPLEVEL_PROP_ACCEPT_FOCUS:
- break;
-
- case LAST_PROP + GDK_TOPLEVEL_PROP_FOCUS_ON_MAP:
- break;
-
case LAST_PROP + GDK_TOPLEVEL_PROP_DECORATED:
break;
g_value_set_pointer (value, NULL);
break;
- case LAST_PROP + GDK_TOPLEVEL_PROP_ACCEPT_FOCUS:
- break;
-
- case LAST_PROP + GDK_TOPLEVEL_PROP_FOCUS_ON_MAP:
- break;
-
case LAST_PROP + GDK_TOPLEVEL_PROP_DECORATED:
break;
surface->width = 1;
surface->height = 1;
- surface->accept_focus = TRUE;
- surface->focus_on_map = TRUE;
surface->alpha = 255;
surface->device_cursor = g_hash_table_new_full (NULL, NULL,
guint destroyed : 2;
- guint accept_focus : 1;
- guint focus_on_map : 1;
guint support_multidevice : 1;
guint viewable : 1; /* mapped and all parents mapped */
guint in_update : 1;
"Icon List",
"The list of icon textures",
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY));
- g_object_interface_install_property (iface,
- g_param_spec_boolean ("accept-focus",
- "Accept focus",
- "Whether the surface should accept keyboard focus",
- TRUE,
- G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY));
- g_object_interface_install_property (iface,
- g_param_spec_boolean ("focus-on-map",
- "Focus on map",
- "Whether the surface should receive keyboard focus on map",
- TRUE,
- G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY));
g_object_interface_install_property (iface,
g_param_spec_boolean ("decorated",
"Decorated",
g_object_class_override_property (object_class, first_prop + GDK_TOPLEVEL_PROP_TRANSIENT_FOR, "transient-for");
g_object_class_override_property (object_class, first_prop + GDK_TOPLEVEL_PROP_MODAL, "modal");
g_object_class_override_property (object_class, first_prop + GDK_TOPLEVEL_PROP_ICON_LIST, "icon-list");
- g_object_class_override_property (object_class, first_prop + GDK_TOPLEVEL_PROP_ACCEPT_FOCUS, "accept-focus");
- g_object_class_override_property (object_class, first_prop + GDK_TOPLEVEL_PROP_FOCUS_ON_MAP, "focus-on-map");
g_object_class_override_property (object_class, first_prop + GDK_TOPLEVEL_PROP_DECORATED, "decorated");
g_object_class_override_property (object_class, first_prop + GDK_TOPLEVEL_PROP_DELETABLE, "deletable");
g_object_class_override_property (object_class, first_prop + GDK_TOPLEVEL_PROP_FULLSCREEN_MODE, "fullscreen-mode");
return GDK_TOPLEVEL_GET_IFACE (toplevel)->show_window_menu (toplevel, event);
}
-/**
- * gdk_toplevel_set_accept_focus:
- * @toplevel: a #GdkToplevel
- * @accept_focus: whether @toplevel should accept keyboard focus
- *
- * Setting @accept_focus to %FALSE hints the desktop environment
- * that the surface doesn’t want to receive input focus.
- */
-void
-gdk_toplevel_set_accept_focus (GdkToplevel *toplevel,
- gboolean accept_focus)
-{
- g_return_if_fail (GDK_IS_TOPLEVEL (toplevel));
-
- g_object_set (toplevel, "accept-focus", accept_focus, NULL);
-}
-
-/**
- * gdk_toplevel_set_focus_on_map:
- * @toplevel: a #GdkToplevel
- * @focus_on_map: whether @toplevel should receive input focus when mapped
- *
- * Setting @focus_on_map to %FALSE hints the desktop environment that the
- * surface doesn’t want to receive input focus when it is mapped.
- * focus_on_map should be turned off for surfaces that aren’t triggered
- * interactively (such as popups from network activity).
- */
-void
-gdk_toplevel_set_focus_on_map (GdkToplevel *toplevel,
- gboolean focus_on_map)
-{
- g_return_if_fail (GDK_IS_TOPLEVEL (toplevel));
-
- g_object_set (toplevel, "focus-on-map", focus_on_map, NULL);
-}
-
/**
* gdk_toplevel_set_decorated:
* @toplevel: a #GdkToplevel
gboolean gdk_toplevel_show_window_menu (GdkToplevel *toplevel,
GdkEvent *event);
-GDK_AVAILABLE_IN_ALL
-void gdk_toplevel_set_accept_focus (GdkToplevel *toplevel,
- gboolean accept_focus);
-
-GDK_AVAILABLE_IN_ALL
-void gdk_toplevel_set_focus_on_map (GdkToplevel *toplevel,
- gboolean focus_on_map);
-
GDK_AVAILABLE_IN_ALL
void gdk_toplevel_set_decorated (GdkToplevel *toplevel,
gboolean decorated);
GDK_TOPLEVEL_PROP_TRANSIENT_FOR,
GDK_TOPLEVEL_PROP_MODAL,
GDK_TOPLEVEL_PROP_ICON_LIST,
- GDK_TOPLEVEL_PROP_ACCEPT_FOCUS,
- GDK_TOPLEVEL_PROP_FOCUS_ON_MAP,
GDK_TOPLEVEL_PROP_DECORATED,
GDK_TOPLEVEL_PROP_DELETABLE,
GDK_TOPLEVEL_PROP_FULLSCREEN_MODE,
case LAST_PROP + GDK_TOPLEVEL_PROP_ICON_LIST:
break;
- case LAST_PROP + GDK_TOPLEVEL_PROP_ACCEPT_FOCUS:
- break;
-
- case LAST_PROP + GDK_TOPLEVEL_PROP_FOCUS_ON_MAP:
- break;
-
case LAST_PROP + GDK_TOPLEVEL_PROP_DECORATED:
break;
g_value_set_pointer (value, NULL);
break;
- case LAST_PROP + GDK_TOPLEVEL_PROP_ACCEPT_FOCUS:
- break;
-
- case LAST_PROP + GDK_TOPLEVEL_PROP_FOCUS_ON_MAP:
- break;
-
case LAST_PROP + GDK_TOPLEVEL_PROP_DECORATED:
break;
case WM_MOUSEACTIVATE:
{
- if (GDK_IS_DRAG_SURFACE (window)
- || !window->accept_focus)
+ if (GDK_IS_DRAG_SURFACE (window))
{
*ret_valp = MA_NOACTIVATE;
return_val = TRUE;
gboolean unminimize)
{
GdkWin32Surface *surface;
- gboolean focus_on_map = FALSE;
DWORD exstyle;
if (window->destroyed)
/* Other cases */
- if (!already_mapped)
- focus_on_map = window->focus_on_map;
-
exstyle = GetWindowLong (GDK_SURFACE_HWND (window), GWL_EXSTYLE);
/* Use SetWindowPos to show transparent windows so automatic redraws
{
UINT flags = SWP_SHOWWINDOW | SWP_NOREDRAW | SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER;
- if (GDK_IS_DRAG_SURFACE (window) || !focus_on_map)
+ if (GDK_IS_DRAG_SURFACE (window))
flags |= SWP_NOACTIVATE;
SetWindowPos (GDK_SURFACE_HWND (window),
}
else if (window->state & GDK_SURFACE_STATE_MINIMIZED)
{
- if (focus_on_map)
- GtkShowWindow (window, SW_RESTORE);
- else
- GtkShowWindow (window, SW_SHOWNOACTIVATE);
+ GtkShowWindow (window, SW_RESTORE);
}
- else if (GDK_IS_DRAG_SURFACE (window) || !focus_on_map)
+ else if (GDK_IS_DRAG_SURFACE (window))
{
if (!IsWindowVisible (GDK_SURFACE_HWND (window)))
GtkShowWindow (window, SW_SHOWNOACTIVATE);
API_CALL (SetWindowPos, (GDK_SURFACE_HWND (window), HWND_TOPMOST,
0, 0, 0, 0,
SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE | SWP_NOOWNERZORDER));
- else if (window->accept_focus)
+ else
/* Do not wrap this in an API_CALL macro as SetForegroundWindow might
* fail when for example dragging a window belonging to a different
* application at the time of a gtk_window_present() call due to focus
* stealing prevention. */
SetForegroundWindow (GDK_SURFACE_HWND (window));
- else
- API_CALL (SetWindowPos, (GDK_SURFACE_HWND (window), HWND_TOP,
- 0, 0, 0, 0,
- SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE | SWP_NOOWNERZORDER));
}
}
case LAST_PROP + GDK_TOPLEVEL_PROP_ICON_LIST:
break;
- case LAST_PROP + GDK_TOPLEVEL_PROP_ACCEPT_FOCUS:
- break;
-
- case LAST_PROP + GDK_TOPLEVEL_PROP_FOCUS_ON_MAP:
- break;
-
case LAST_PROP + GDK_TOPLEVEL_PROP_DECORATED:
break;
g_value_set_pointer (value, NULL);
break;
- case LAST_PROP + GDK_TOPLEVEL_PROP_ACCEPT_FOCUS:
- break;
-
- case LAST_PROP + GDK_TOPLEVEL_PROP_FOCUS_ON_MAP:
- break;
-
case LAST_PROP + GDK_TOPLEVEL_PROP_DECORATED:
break;
/* There is no way of knowing reliably whether we are viewable;
* so trap errors asynchronously around the XSetInputFocus call
*/
- if (toplevel && win->accept_focus)
+ if (toplevel)
{
gdk_x11_display_error_trap_push (display);
XSetInputFocus (GDK_DISPLAY_XDISPLAY (display),
XA_WINDOW, 32, PropModeReplace,
(guchar *) &toplevel->focus_window, 1);
- if (!surface->focus_on_map)
- gdk_x11_surface_set_user_time (surface, 0);
- else if (GDK_X11_DISPLAY (x11_screen->display)->user_time != 0)
+ if (GDK_X11_DISPLAY (x11_screen->display)->user_time != 0)
gdk_x11_surface_set_user_time (surface, GDK_X11_DISPLAY (x11_screen->display)->user_time);
ensure_sync_counter (surface);
return;
wm_hints.flags = StateHint | InputHint;
- wm_hints.input = surface->accept_focus ? True : False;
+ wm_hints.input = True;
wm_hints.initial_state = NormalState;
if (surface->state & GDK_SURFACE_STATE_MINIMIZED)
#endif
}
-static void
-gdk_x11_surface_set_accept_focus (GdkSurface *surface,
- gboolean accept_focus)
-{
- accept_focus = accept_focus != FALSE;
-
- if (surface->accept_focus != accept_focus)
- {
- surface->accept_focus = accept_focus;
-
- if (!GDK_SURFACE_DESTROYED (surface))
- update_wm_hints (surface, FALSE);
- }
-}
-
-static void
-gdk_x11_surface_set_focus_on_map (GdkSurface *surface,
- gboolean focus_on_map)
-{
- focus_on_map = focus_on_map != FALSE;
-
- if (surface->focus_on_map != focus_on_map)
- {
- surface->focus_on_map = focus_on_map;
-
- if (!GDK_SURFACE_DESTROYED (surface) &&
- !surface->focus_on_map)
- gdk_x11_surface_set_user_time (surface, 0);
- }
-}
-
/**
* gdk_x11_surface_set_user_time:
* @surface: (type GdkX11Surface): A toplevel #GdkSurface
g_object_notify_by_pspec (G_OBJECT (surface), pspec);
break;
- case LAST_PROP + GDK_TOPLEVEL_PROP_ACCEPT_FOCUS:
- gdk_x11_surface_set_accept_focus (surface, g_value_get_boolean (value));
- g_object_notify_by_pspec (G_OBJECT (surface), pspec);
- break;
-
- case LAST_PROP + GDK_TOPLEVEL_PROP_FOCUS_ON_MAP:
- gdk_x11_surface_set_focus_on_map (surface, g_value_get_boolean (value));
- g_object_notify_by_pspec (G_OBJECT (surface), pspec);
- break;
-
case LAST_PROP + GDK_TOPLEVEL_PROP_DECORATED:
gdk_x11_surface_set_decorations (surface, g_value_get_boolean (value) ? GDK_DECOR_ALL : 0);
g_object_notify_by_pspec (G_OBJECT (surface), pspec);
g_value_set_pointer (value, NULL);
break;
- case LAST_PROP + GDK_TOPLEVEL_PROP_FOCUS_ON_MAP:
- break;
-
case LAST_PROP + GDK_TOPLEVEL_PROP_DECORATED:
{
GdkWMDecoration decorations = GDK_DECOR_ALL;